/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entidades;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author diego
 */
@Entity
@Table(name = "Domicilio")
public class Domicilio implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Basic(optional = false)
    @Column(name = "idDomicilio")
    private Integer idDomicilio;
    @Column(name = "barrio")
    private String barrio;
    @Column(name = "calle")
    private String calle;
    @Column(name = "nroCalle")
    private String nroCalle;
    @Column(name = "nroDpto")
    private String nroDpto;
    @Column(name = "piso")
    private String piso;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idDomicilio")
    private List<Oficina> oficinaCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idDomicilio")
    private List<Empleado> empleadolista;
    @JoinColumn(name = "idDistrito", referencedColumnName = "idDistrito")
    @ManyToOne(optional = false)
    private Distrito idDistrito;

    public Domicilio() {
    }

    public Domicilio(Integer idDomicilio) {
        this.idDomicilio = idDomicilio;
    }

    public Integer getIdDomicilio() {
        return idDomicilio;
    }

    public void setIdDomicilio(Integer idDomicilio) {
        this.idDomicilio = idDomicilio;
    }

    public String getBarrio() {
        return barrio;
    }

    public void setBarrio(String barrio) {
        this.barrio = barrio;
    }

    public String getCalle() {
        return calle;
    }

    public void setCalle(String calle) {
        this.calle = calle;
    }

    public String getNroCalle() {
        return nroCalle;
    }

    public void setNroCalle(String nroCalle) {
        this.nroCalle = nroCalle;
    }

    public String getNroDpto() {
        return nroDpto;
    }

    public void setNroDpto(String nroDpto) {
        this.nroDpto = nroDpto;
    }

    public String getPiso() {
        return piso;
    }

    public void setPiso(String piso) {
        this.piso = piso;
    }

    public List<Oficina> getOficinaCollection() {
        return oficinaCollection;
    }

    public void setOficinaCollection(List<Oficina> oficinaCollection) {
        this.oficinaCollection = oficinaCollection;
    }

    public List<Empleado> getEmpleadoCollection() {
        return empleadolista;
    }

    public void setEmpleadoCollection(List<Empleado> empleadoCollection) {
        this.empleadolista = empleadoCollection;
    }

    public Distrito getIdDistrito() {
        return idDistrito;
    }

    public void setIdDistrito(Distrito idDistrito) {
        this.idDistrito = idDistrito;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idDomicilio != null ? idDomicilio.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Domicilio)) {
            return false;
        }
        Domicilio other = (Domicilio) object;
        if ((this.idDomicilio == null && other.idDomicilio != null) || (this.idDomicilio != null && !this.idDomicilio.equals(other.idDomicilio))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entidades.Domicilio[ idDomicilio=" + idDomicilio + " ]";
    }
}
